define(['require'],function (require) {
    $.fn.extend({
        formSubmit: function () {
            var obj = $(this);
            $.post({
                url: obj.attr("action"),
                type: 'POST',
                cache: false,
                data: new FormData(obj[0]),
                processData: false,
                contentType: false,
                dataType: "json",
                success: function (bak) {
                    layer.alert("success", function (me) {
                        console.log(bak);
                        layer.close(me);
                    });
                }
            });
        }
    });

    $("form").filter("[auto]").on("submit", function () {
        $(this).formSubmit();
        return false;
    })

    return {
        name:'zl'
    };
});